package com.hopu.v1.controller.front.register;

import com.hopu.v1.pojo.classes.Student;
import com.hopu.v1.pojo.common.R;
import com.hopu.v1.pojo.common.Update;
import com.hopu.v1.service.admin.classes.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/front/register")
public class RegisterController {

    @Autowired
    private StudentService studentService;

    @PostMapping("register")
    public R register(@Validated(Update.class) Student student){
        System.out.println(student);
        this.studentService.addStudent(student);
        System.out.println(student.getBirthday());
        return R.ok("添加成功");
    }
}
